
package GUI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.util.List;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import Listeners.SubmitNewPaperListener;
import Model.Conference;
import Model.User;

/**
 * Panel that displays the Sub Program Chair's current papers associated with
 * the conference . It allows the SPC to assign papers to reviewers and submit
 * recommendations.
 * 
 * @author William Kim
 * @version 11/27/2012 Reused Paul Schultz code from AuthorToolPanel.java
 */
@SuppressWarnings("serial")
public class SubChairToolPanel extends JPanel
{

  /**
   * Constructs new AuthorTool Panel.
   * 
   * @param the_conf
   *          Conference data used to populate panel.
   * @param the_user
   *          User data used to populate panel.
   * @param the_frame
   *          data used change current (viewed) panel.
   */
  public SubChairToolPanel(final Conference the_conf, final User the_user,
      final ConferenceWizardFrame the_frame)
  {
    super();
    setLayout(new BorderLayout());
    setPreferredSize(new Dimension(550, 600));
    setBackground(Color.WHITE);

    JLabel header = new JLabel("Subprogram Chair Tool");
    header.setForeground(Color.BLUE);
    header.setFont(new Font("Serif", Font.BOLD, 38));
    header.setAlignmentY(CENTER_ALIGNMENT);

    JLabel instructions = new JLabel(
        "This page is for assigning reviewers and submitting recommendations.");
    instructions.setForeground(Color.RED);
    instructions.setFont(new Font("Serif", Font.PLAIN, 16));

    JPanel north_panel = new JPanel();
    north_panel.setLayout(new BoxLayout(north_panel, BoxLayout.Y_AXIS));
    north_panel.setBackground(Color.WHITE);

    north_panel.add(header);
    north_panel.add(Box.createVerticalStrut(10));
    north_panel.add(instructions);
    add(north_panel, BorderLayout.NORTH);

    JPanel papers_panel = new JPanel();
    papers_panel.setLayout(new BoxLayout(papers_panel, BoxLayout.Y_AXIS));
    papers_panel.setBackground(Color.WHITE);

    JLabel pLabel = new JLabel("Assigned Papers:");
    pLabel.setFont(new Font("Plain", Font.PLAIN, 28));
    pLabel.setForeground(Color.MAGENTA);
    pLabel.setAlignmentX(0);
    papers_panel.add(pLabel);
    papers_panel.add(Box.createVerticalStrut(20));

    List<Model.Paper> papers = the_conf.getPapersAssignedToSubChairs(the_user);

    for (Model.Paper p : papers)
    {
      papers_panel.add(new SPCPaperPanel(p, the_conf, the_user, the_frame));
      // papers_panel.add(Box.createVerticalStrut(30));
    }

    JScrollPane scroll_panel = new JScrollPane(papers_panel);
    add(scroll_panel, BorderLayout.CENTER);

  }
}
